package com.mz.mattress.admin.api.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mz.mattress.admin.api.req.MemberMerQueryReq;
import com.mz.mattress.admin.service.MemberMerService;
import com.mz.mattress.api.common.Constants;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.MemberMer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping(Constants.ADMIN_PATH + "memberMer")
public class MemberMerController {

    @Autowired
    private MemberMerService memberMerService;

    @GetMapping(value = "listPage")
    public Result<IPage<MemberMer>> list(MemberMerQueryReq req) {
        return memberMerService.listPage(req);
    }

    @GetMapping(value = "/{id}")
    public Result<MemberMer> getById(@PathVariable Long id) {
        return memberMerService.getById(id);
    }

    @DeleteMapping
    public Result delete(@RequestBody Long id) {
        return memberMerService.deleteById(id);
    }

    @GetMapping(value = "/resetType/{id}")
    public Result resetType(@PathVariable Long id) {
        return memberMerService.resetType(id);
    }

    @GetMapping(value = "/resetPassword/{id}")
    public Result resetPassword(@PathVariable Long id) {
        return memberMerService.resetPassword(id);
    }

}
